//
//  UIButton+GYButton.m
//  Visitor
//
//  Created by x on 2017/9/12.
//  Copyright © 2017年 HLB. All rights reserved.
//

#import "UIButton+GYButton.h"

@implementation UIButton (GYButton)

+ (UIButton *)buttonWith:(NSString *)title titleColor:(UIColor *)titleColor borderColor:(UIColor *)borderColor backgroundColor:(UIColor *)bgColor tag:(NSInteger)tag target:(id)target action:(SEL)action {
    
    UIButton *btu = [UIButton buttonWithTitle:title titleColor:titleColor tag:tag target:target action:action];
        btu.titleLabel.font = [UIFont systemFontOfSize:18];
    btu.layer.cornerRadius = 4;
    [btu setBackgroundColor:bgColor];
    btu.layer.borderColor = borderColor.CGColor;
    btu.layer.borderWidth = 0.5;
    
    return btu;
}

+ (UIButton *)buttonWithTitle:(NSString *)title titleColor:(UIColor *)titleColor tag:(NSInteger)tag target:(id)target action:(SEL)action {
    UIButton *btu = [[UIButton alloc] init];
    [btu setTitle:title forState:UIControlStateNormal];
    [btu setTitleColor:titleColor forState:UIControlStateNormal];
    btu.titleLabel.font = [UIFont systemFontOfSize:14];
    btu.translatesAutoresizingMaskIntoConstraints = NO;
    btu.tag = tag;
    [btu addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    return  btu;
}
@end
